package models
{
    import com.pamakids.utils.CloneUtil;
    
    public class PaintData
    {
        public function PaintData()
        {
        }
        
        public var theme:ThemeVo;
        public var match:MatchVO;
        public var drawData:Object;
        public var textureData:Array;
        public var textData:Array;
        
        public var path:String;
        
        public static function clone(obj:Object):PaintData
        {
            var pd:PaintData=new PaintData();
            if(obj.theme is String)
            {
                pd.theme=ThemeManager.getInstance().getThemeVoByPath(obj.theme as String);
            }else if(obj.theme&&obj.theme.theme)
                pd.theme=ThemeManager.getInstance().getThemeVoByPath(obj.theme.theme as String);
            if(!pd.theme)
                pd.theme=ThemeManager.getInstance().getThemeVoByPath('');
            pd.match=CloneUtil.convertObject(obj.match, MatchVO);
            pd.drawData=obj.drawData;
            pd.textureData=obj.textureData;
            pd.textData=obj.textData;
            pd.path=obj.path;
            
            return pd;
        }
        
        public function getTextureArr():Array
        {
            var arr:Array=[];
            arr=drawData.brushColor;
            if(arr)
                arr=arr.filter(function(item:*,index:int,arr:Array):Boolean{return !(item is uint)});
            if(arr&&arr.length)
                return arr;
            return null;
        }
    }
}


